package name.mrzc.licensing.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import name.mrzc.licensing.db.ILicenseDB;
import name.mrzc.licensing.model.License;

@Mapper
public interface LicenseMapper extends ILicenseDB{

	@Results({ @Result(property = "licenseId", column = "license_id"),
			@Result(property = "organizationId", column = "organization_id"),
			@Result(property = "productName", column = "product_name"),
			@Result(property = "licenseType", column = "license_type"),
			@Result(property = "licenseMax", column = "license_max"),
			@Result(property = "licenseAllocated", column = "license_allocated"),
			@Result(property = "comment", column = "comment") })
	@Select("select * from licenses where organization_id = #{organizationId}")
	public List<License> findByOrganizationId(@Param("organizationId") String organizationId);

	public License findByOrganizationIdAndLicenseId(String organizationId, String licenseId);
}
